package o;

import java.util.Locale;

public final class ha {
    public static final gt ʽ = j.ˏ;
    public static final gt ˊ = new d(e.ॱ, true);
    public static final gt ˋ = new d(null, true);
    public static final gt ˎ = new d(null, false);
    public static final gt ˏ = new d(e.ॱ, false);
    public static final gt ॱ = new d(b.ˏ, false);

    static abstract class a implements gt {
        private final c ˊ;

        protected abstract boolean ˊ();

        a(c cVar) {
            this.ˊ = cVar;
        }

        public boolean ॱ(CharSequence charSequence, int i, int i2) {
            if (charSequence == null || i < 0 || i2 < 0 || charSequence.length() - i2 < i) {
                throw new IllegalArgumentException();
            } else if (this.ˊ == null) {
                return ˊ();
            } else {
                return ˏ(charSequence, i, i2);
            }
        }

        private boolean ˏ(CharSequence charSequence, int i, int i2) {
            switch (this.ˊ.ˏ(charSequence, i, i2)) {
                case 0:
                    return true;
                case 1:
                    return false;
                default:
                    return ˊ();
            }
        }
    }

    interface c {
        int ˏ(CharSequence charSequence, int i, int i2);
    }

    static class b implements c {
        static final b ˏ = new b(true);
        private final boolean ˋ;

        public int ˏ(CharSequence charSequence, int i, int i2) {
            int i3 = i + i2;
            int i4 = 0;
            while (i < i3) {
                switch (ha.ॱ(Character.getDirectionality(charSequence.charAt(i)))) {
                    case 0:
                        if (!this.ˋ) {
                            i4 = 1;
                            break;
                        }
                        return 0;
                    case 1:
                        if (this.ˋ) {
                            i4 = 1;
                            break;
                        }
                        return 1;
                    default:
                        break;
                }
                i++;
            }
            if (i4 == 0) {
                return 2;
            }
            if (this.ˋ) {
                return 1;
            }
            return 0;
        }

        private b(boolean z) {
            this.ˋ = z;
        }
    }

    static class d extends a {
        private final boolean ˋ;

        d(c cVar, boolean z) {
            super(cVar);
            this.ˋ = z;
        }

        protected boolean ˊ() {
            return this.ˋ;
        }
    }

    static class e implements c {
        static final e ॱ = new e();

        public int ˏ(CharSequence charSequence, int i, int i2) {
            int i3 = i + i2;
            int i4 = 2;
            while (i < i3 && i4 == 2) {
                i4 = ha.ˏ(Character.getDirectionality(charSequence.charAt(i)));
                i++;
            }
            return i4;
        }

        private e() {
        }
    }

    static class j extends a {
        static final j ˏ = new j();

        j() {
            super(null);
        }

        protected boolean ˊ() {
            if (hb.ˎ(Locale.getDefault()) == 1) {
                return true;
            }
            return false;
        }
    }

    static int ॱ(int i) {
        switch (i) {
            case 0:
                return 1;
            case 1:
            case 2:
                return 0;
            default:
                return 2;
        }
    }

    static int ˏ(int i) {
        switch (i) {
            case 0:
            case 14:
            case 15:
                return 1;
            case 1:
            case 2:
            case 16:
            case 17:
                return 0;
            default:
                return 2;
        }
    }
}
